﻿if( typeof Proxy == "undefined" ) Proxy = ProxyAsync;
var prm = Sys.WebForms.PageRequestManager.getInstance();

var SearchEngine = 1;
var SearchEngineDefaultString = "Google";
function UpdateSearchEngine(val)
{
   var banner_search = $('banner_search');
   var banner_search_txt = $('banner_search_txt');
   switch (val)
   {
      case 2:
         banner_search.src = "/images/search/yahoo.gif";
         SearchEngineDefaultString = "Yahoo!";
         break;
      case 3:
         banner_search.src = "/images/search/live.gif";
         SearchEngineDefaultString = "Live!";
         break;
      default:
         banner_search.src = "/images/search/google.gif";
         SearchEngineDefaultString = "Google";
         break;
   }
   SearchEngine = val;
   banner_search_txt.value = SearchEngineDefaultString;
}

function Search_OnBlur(element)
{
   if (element.value == "")
      element.value = SearchEngineDefaultString;
}

function Search_OnFocus(element)
{
   if (element.value == SearchEngineDefaultString)
      element.value = "";
}

function Search_OnCRLF()
{
   var url = "";
   var search_txt = $('banner_search_txt').value;
   
   switch (SearchEngine)
   {
      case 2:
         url = "http://search.yahoo.com/search?p=" + encodeURI(search_txt);
         break;
      case 3:
         url = "http://search.live.com/results.aspx?q=" + encodeURI(search_txt);
         break;
      default:
         url = "http://www.google.com/search?q=" + encodeURI(search_txt);
         break;
   }
   winopen_withlocationbar(url);
   
   return false;
}

var TabAccessLevel = {};
TabAccessLevel.Owner = 0;
TabAccessLevel.Tab_EditName = 1;
TabAccessLevel.Tab_Share = 2;
TabAccessLevel.Tab_Delete = 3;
TabAccessLevel.Tab_AddWidgets = 4;
TabAccessLevel.Tab_ChangeLayout = 5;
TabAccessLevel.Tab_ChangeTheme = 6;
TabAccessLevel.Widget_Edit = 7;
TabAccessLevel.Widget_Reorder = 8;
TabAccessLevel.Widget_Delete = 9;
TabAccessLevel.Widget_EditTitle = 10;
TabAccessLevel.Read = 11;

function GetAccessLevelStr(lvl)
{
   switch(lvl)
   {
      case 0:
         return "Owner";
      case 1:
         return "Edit Tab Name";
      case 2:
         return "Share Tab to Others";
      case 3:
         return "Delete Tab";
      case 4:
         return "Add Widgets to Tab";
      case 5:
         return "Change Tab Layout";
      case 6:
         return "Change Tab Theme";
      case 7:
         return "Edit Widget Properties";
      case 8:
         return "Reorder Widget";
      case 9:
         return "Delete Widget";
      case 10:
         return "Edit Widget Title";
      case 11:
         return "Read";
      default:
         return "None";
   }
}

JSON.set_defaultFailedCallback(DefaultFailedCallback);
function DefaultFailedCallback(error, userContext, methodName) 
{
    if(error !== null) 
    {
        alert("Error occured at function: " + methodName + "\n" + error.get_message());
    }
}
   
if(typeof(Sys) !== "undefined")Sys.Application.notifyScriptLoaded();
